using Arcane.Source.TileMatch;
using Godot;

namespace Arcane.Source
{
    public static class Rule
    {
        public const int COL = 7;
        public const int ROW = 10;

        public const int MAX_LEVEL = 3;

        public const int STANDARD_TPS = 60;
        public const double STANDARD_TICK_TIME = 1.0 / STANDARD_TPS;

        public const int DROP_TICK = 8;

        public static bool ColValid(int col) => col >= 0 && col < COL;
        public static bool RowValid(int row) => row >= 0 && row < ROW;
        public static bool CellValid(int col, int row) => ColValid(col) && RowValid(row);
        public static bool CellValid(Vector2I cell) => CellValid(cell.X, cell.Y);

        public readonly static Vector2I[] AVALIABLE_CELLS = [new(0, 0), new(1, 0), new(-1, 0), new(0, 1), new(0, -1)];

        public readonly static (int c, int r, TileSide side)[] NEIGHBORS = [(1, 0, TileSide.Right), (0, 1, TileSide.Bottom), (-1, 0, TileSide.Left), (0, -1, TileSide.Top)];

        public readonly static Color[] TYPE_COLORS =
        [
            new(.8f, .2f, .2f),
            new(.8f, .8f, .2f),
            new(.2f, .8f, .2f),
            new(.2f, .8f, .8f),
            new(.2f, .2f, .8f),
        ];

        public const int HINT_TICK = 300;
    }
}